@echo off

if "%ZIP_HOME%"=="" (
	set ZIP_HOME=C:\Program Files\7-Zip
)

if not exist "%ZIP_HOME%\7z.exe" (
	echo "Failed to locate 7zip."
	goto _end_
)

if not exist "C:\BIN\datetime.vbs" ( 
	echo "VBScript datetime.vbs could not be found."
	goto _end_
)

for /f "tokens=* delims=/" %%A in ('cscript C:\BIN\datetime.vbs') do set CURRENT_TIME=%%A

if "%2"=="" (
	echo makezip - Make zip package with the name of current datetime.
	echo usage: makezip ARCHIVE_NAME_PREFIX FILE1 [FILE2 ...]
	goto _end_
)

set PREFIX=%1

:_next_
if "%2"=="" goto _end_
"%ZIP_HOME%\7z.exe" a %PREFIX%_%CURRENT_TIME%.zip "%2"
shift /1
goto _next_

:_end_
